//
//  KBShopViewController.m
//  喜马拉雅改良版框架
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "KBShopViewController.h"

@interface KBShopViewController ()<UIWebViewDelegate>

@property (nonatomic,retain)UIWebView *shopWebView;

@end

@implementation KBShopViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.shopWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT*1)];
    self.shopWebView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.shopWebView];
    self.shopWebView.delegate = self;
    
    NSURL *url = [NSURL URLWithString:_urlStr];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.shopWebView loadRequest:request];
    
    if (_row == 2)
    {
        self.navigationItem.title = @"商城";
    }
    else if (_row == 3)
    {
        self.navigationItem.title = @"铃音";
    }
    
    
    UIButton * backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    backButton.frame = CGRectMake(0, 0 , 40, 40);
    backButton.backgroundColor = [UIColor clearColor];
    [backButton setImage:[UIImage imageNamed:@"icon_back_h.png"] forState:UIControlStateNormal];
    [backButton setImage:[UIImage imageNamed:@"icon_back_h.png"] forState:UIControlStateHighlighted];
    [backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];

    
    UIButton * shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
    shareButton.frame = CGRectMake(0, 0 , 20, 30);
    shareButton.backgroundColor = [UIColor clearColor];
    [shareButton setImage:[UIImage imageNamed:@"icon_share_n@2x.png"] forState:UIControlStateNormal];
    [shareButton setImage:[UIImage imageNamed:@"icon_share_h@2x.png"] forState:UIControlStateHighlighted];
    [shareButton addTarget:self action:@selector(shareBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.tabBarController.tabBar.hidden = YES;
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:shareButton];
    
}

#pragma mark - 返回按钮方法
-(void)backButtonAction:(UIButton *)btn
{
    [self.navigationController popViewControllerAnimated:YES];
    //    [[NSNotificationCenter defaultCenter] postNotificationName:@"createBigButton" object:[TOPlayButton shareButton]];
    //    [self.tabBarController.tabBarImageView addSubview:[TOPlayButton shareButton]];
}

-(void)shareBtnAction:(UIButton *)btn
{
    NSLog(@"分享");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
